package example;

import lombok.extern.slf4j.Slf4j;
import org.redisson.Redisson;
import org.redisson.config.Config;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.core.env.ConfigurableEnvironment;

@SpringBootApplication
@Slf4j
public class RedisLock_Application {

    public static void main(String[] args) {
        ConfigurableEnvironment environment = SpringApplication.run(RedisLock_Application.class, args).getEnvironment();
        log.info("\n  server.port : {} \n   http://redislock",
                environment.getProperty("server.port"));
    }

    @Bean
    public Redisson redisson() {
        Config config = new Config();
        config.useSingleServer().setAddress("redis://106.13.55.213:6379").setPassword("zw123456").setDatabase(14);
        return (Redisson) Redisson.create(config);
    }

}
